import java.util.HashSet;

/**
 * @author mazouri
 * @create 2023-03-03 9:45
 */
public class _03_findRepeatNumber {
    public int findRepeatNumber(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        int res = -1;
        for (int num : nums) {
            if (set.contains(num)) {
                res = num;
                break;
            } else {
                set.add(num);
            }
        }
        return res;
    }
}
